/**
 * @author May
 *
 * excel的时间单独做解析
 */
export default {
    name: "excelExportDate",
    data() {
        return {};
    },

    methods: {
        exportDate(numb) {

            function formatTime(date) {
                return year + '-' + month + '-' + day;
            }

            if (numb > 0) {
                // 解析excel的垃圾时间
                const time = new Date((numb - 1) * 24 * 3600000 + 1);
                let h = time.getHours() + 16;
                let yeraData = new Date(1900, 0, numb - 1)
                let year = yeraData.getFullYear();
                let month = yeraData.getMonth() + 1
                month = month < 10 ? '0' + month : month;
                let day = yeraData.getDate()
                day = day < 10 ? '0' + day : day;
                if (h > 23) {
                    h = h - 24;
                }
                let m = time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes();
                let s = time.getSeconds() < 10 ? "0" + time.getSeconds() : time.getSeconds();
                return `${year}-${month}-${day}`;
                // return `${year}-${month}-${day} ${h}:${m}:${s}`;
            } else {
                console.log(numb)
                return '非法日期格式';
            }
        }

    }
};